//
//  MyRadioButton.m
//  CarTown
//
//  Created by xionghao on 15/8/7.
//  Copyright (c) 2015年 熊浩. All rights reserved.
//

#import "MyRadioButton.h"

@implementation MyRadioButton

-(instancetype)init{
    if (self=[super init]) {
        self.titleLabel.textAlignment=NSTextAlignmentCenter;
        self.imageView.contentMode=UIViewContentModeScaleAspectFit;
    }
    return self;
}

-(void)awakeFromNib{
    self.titleLabel.textAlignment=NSTextAlignmentCenter;
    self.imageView.contentMode=UIViewContentModeScaleAspectFit;

}

-(CGRect)imageRectForContentRect:(CGRect)contentRect{
    CGFloat height=contentRect.size.height/2;
    CGFloat imgheight=20;
    CGFloat imgwidth=48;
    CGFloat imgx=(contentRect.size.width-imgwidth)/2;
    CGFloat imgy=height-imgheight;
    return CGRectMake(imgx, imgy, imgwidth, imgheight);
}

-(CGRect)titleRectForContentRect:(CGRect)contentRect{
    CGFloat height=contentRect.size.height/2;
    CGFloat x=0;
    CGFloat y=contentRect.size.height-height;
    CGFloat width=contentRect.size.width;
    return CGRectMake(x, y, width, height);
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
